<script>
	var MODULE_NAME = '<php>echo strtolower(MODULE_NAME)</php>';
</script>

<ul class="nav-container first-nav">
	<li class="nav-item first-nav-item"><a href="/">首页</a></li>
	<li class="nav-item first-nav-item">
		<a href="javascript:;"  data-step="1" data-intro="若您有可选的计划，可以在这里选择合适的推广方式" data-position='bottom'>
			推广计划
		</a>
		<ul class="nav-container second-nav">
			<li class="nav-item second-nav-item">
				<a id="maxplan" href="javascript:void(0);">新建计划</a>
			</li>
			<volist name="campaigns" id="v">
				<li class="nav-item second-nav-item">
					<a href="/campaign/manage?campaign_id={$v.campaign_id}" class="campaign-title-{$v.campaign_id}">{$v.title}</a>
				</li>
			</volist>
		</ul>
	</li>
	<li class="nav-item first-nav-item">
		<a href="javascript:;" title="新建云智能推广"  data-step="2" data-intro="若您当前没有计划，可以在此新建计划" data-position='bottom'>
			新建云智能推广
		</a>
		<ul class="nav-container second-nav">
			<li class="nav-item second-nav-item"><a href="/promote/wireless" >无线养分</a></li>
			<li class="nav-item second-nav-item"><a href="/promote/attracted">全店低价引流</a></li>
			<li class="nav-item second-nav-item"><a href="/promote/quick">自动低价测款</a></li>
		</ul>
	</li>
	<li class="nav-item first-nav-item">
		<a href="javascript:;" data-step="3" data-intro="宝贝推广后，您可以建立自己的思路，优化宝贝" data-position='bottom'>
			思路优化
		</a>
		<ul class="nav-container second-nav">
			<li class="nav-item second-nav-item"><a href="/algorithm/condition_choose">新增思路</a></li>
			<li class="nav-item second-nav-item"><a href="/algorithm/condition">我的思路</a></li>
			<li class="nav-item second-nav-item"><a href="/algorithm/platform">平台思路</a></li>
		</ul>
	</li>
	<li class="nav-item first-nav-item">
		<a href="javascript:;" data-step="4" data-intro="选择转化好的关键词进行卡位，提升流量带来更多转化" data-position='bottom'>
			智能卡位
		</a>
		<ul class="nav-container second-nav">
			<li class="nav-item second-nav-item"><a href="/shortcut/ranking_choose" class="addKawei">新增卡位</a></li>
			<li class="nav-item second-nav-item"><a href="/ranking/ranking_list">我的卡位策略</a></li>
		</ul>
	</li>
	<li class="nav-item first-nav-item">
		<a href="javascript:;" data-step="5" data-intro="在其他工具中可对账户进行数据更新，且对无展现的关键词进行激活" data-position='bottom'>
			其他工具
		</a>
		<ul class="nav-container second-nav">
			<li class="nav-item second-nav-item"><a href="/synchronize/index">数据更新</a></li>
			<li class="nav-item second-nav-item"><a href="/shortcut/noshow">删除垃圾词</a></li>
		</ul>
	</li>
	<li class="nav-item first-nav-item">
		<a href="javascript:;" data-step="6" data-intro="这里有软件的操作手册和常见问题，您有需要的时候可以点击这里；当您日常使用过程中有疑问可咨询我们的专业客服人员" data-position='bottom'>
			使用说明
		</a>
		<ul class="nav-container second-nav">
			<li class="nav-item second-nav-item"><a href="/help/instruction" target="_blank" >操作手册</a></li>
 			<li class="nav-item second-nav-item"><a href="/help/help" target="_blank">常见问题</a></li>
		</ul>
	</li>
</ul>
<include file="{APP_PATH}Template/Campaign/campaign_creator.html"/>
<script>
	$(document).ready(function(){
		$('.nav-container #maxplan').on('click', function(){
			var $html = $(template.render('template_campaign_creator'), {});
			$html.on('click', '.createCampaign', function(event){
				var $this = $(this),
						$form = $(event.delegateTarget),
						title = $form.find('input[name=campaign_name]').val() + $form.find('.postfix').text(),
						$prompt = $form.find('.Prompt');
				if(title.length == 0){
					$prompt.html('推广计划名称不能为空');
					return;
				}
				if(title.length > 20){
					$prompt.html('推广计划名称不能多于20字符');
					return;
				}
				$this.attr('disabled', true);
				wt.post('/campaign/createcampaign',{title:title},function(data){
					var o = $.parseJSON(data);
					o = o.data;
					$prompt.html(o.msg);
					if(o.result) {
						window.location.reload();
					}
					$this.attr('disabled', false);
				});
			});
			$html.on('focus', 'input[name=campaign_name]', function(event){
				var $form = $(event.delegateTarget),
						$prompt = $form.find('.Prompt');
				$prompt.html('');
			});
			wt.showBox($html, '新建推广计划', {cancel: false, ok: false});
		});

	});
</script>